import pywifi
from pywifi import const
import time


def gic():
    wifi = pywifi.PyWiFi()
    ifaces = wifi.interfaces()[0]
    # 网卡名称
    print(ifaces.name())

    print(ifaces.status()) #4已链接 0未连接
    if ifaces.status() == const.IFACE_DISCONNECTED:
        print('未链接')
    else:
        print('已链接')

# 附近扫描无线
def bise():
    wifi = pywifi.PyWiFi()
    ifaces = wifi.interfaces()[0]
    # 网卡名称
    print(ifaces.name())

    # 扫描附近wifi
    ifaces.scan()
    time.sleep(5)
    # 扫描后的结果
    res = ifaces.scan_results()
    datel = []
    for date in res:
        datel = datel.append(date.ssid)

    print(datel )




if __name__ == '__main__':
    bise()
